﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using ajayumi.develop.win32.Transport.WCF.Services.Interfaces;
using ajayumi.develop.win32.Transport.WCF.Services.DataContracts;

namespace ajayumi.develop.win32.Transport.AppUpgrade
{
    /// <summary>
    /// 文件传输客户端类
    /// Author  : 黄乙冬
    /// Date    : 2011-08-30
    /// </summary>
    public class TransportFileServiceClient : ClientBase<ITransportFile>, ITransportFile, IDisposable
    {
        public TransportFileServiceClient()
            : base("TransportFile")
        {

        }

        public TransFileInfo InitUploadFile(TransFileInfo file)
        {
            return base.Channel.InitUploadFile(file);
        }

        public TransFileInfo UploadFile(TransFileInfo file)
        {
            return base.Channel.UploadFile(file);
        }

        public TransFileInfo InitDownloadFile(TransFileInfo file)
        {
            return base.Channel.InitDownloadFile(file);
        }

        public TransFileInfo DownloadFile(TransFileInfo file)
        {
            return base.Channel.DownloadFile(file);
        }

        #region IDisposable

        void IDisposable.Dispose()
        {
            if (this.State == CommunicationState.Opened)
            { this.Close(); }
        }

        #endregion
    }
}
